<?php


namespace app\admin\validates;


use think\Validate;

class StudentValidate extends Validate
{
    /**
     * 验证规则
     * @var array
     */
    protected $rule = [
        'id' => 'require|number',
        'username' => 'require|unique:student|chsDash|max:50',
        'sort' => 'number',
        'grades_id' => 'require|number',
        'classes_id' => 'require|number',
        'special_id' => 'require|number',
        'number' => 'number',
        'realname' => 'require',
        'password' => 'require',
        'sex' => 'require',
    ];

    /**
     * 验证字段描述
     * @var string[]
     */
    protected $field = [
        'id' => 'ID',
        'username' => '学号',
        'sort' => '排序',
        'grades_id' => '年级',
        'classes_id' => '班级',
        'special_id' => '专业',
        'number' => '学号',
        'realname' => '姓名',
        'password' => '密码',
        'sex' => '性别'
    ];

    /**
     * 验证场景
     * @var array
     */
    protected $scene = [
        'add' => ['username', 'sort','grades_id','classes_id','special_id','realname','password','sex'],
        'edit' => ['id', 'sort','grades_id','classes_id','special_id','realname','sex'],
        'del' => ['id'],
        'details' => ['id']
    ];
}